<template>
<div class="wrap w-baojia1 detail">
    <header>
          <img @click="reback" src="@/assets/img/r_w.png" alt="" />
    </header>
    <div class="head">
        <!-- <p>温馨提示：请您在招标结束前发起投标，谢谢！</p> -->
        <h3><span>——————</span> 报价已结束 <span>——————</span></h3>
        <p>温馨提示：请您在招标结束前发起投标，谢谢！</p>
    </div>

    <div class="tips" v-if="bid_data.is_show_tips">

        <p>{{bid_data.tips_content}}</p>
        
    </div>
       
    <ul class="xm-info lists" v-if="bid_data.bid_status != 30">
        <li class="tit">
            <img src="@/assets/img/baojia_icon5.png" alt="" /><span>中标信息</span>
        </li>
        <li class="clearfix list">
            <p>供应商：</p>
            <p>{{bid_data.pick_user_company}}</p>
        </li>
        <li class="clearfix list">
            <p>报价金额：</p>
            <p>￥{{bid_data.pick_price}}</p>
        </li>
        <li class="clearfix list">
            <p>电话：</p>
            <p>{{bid_data.prick_phone}}</p>
        </li>
        <li class="clearfix list">
            <p>咨询及投诉电话：</p>
            <p>{{bid_data.supervise_phone}}</p>
        </li>
    </ul>
     <ul class="xm-info lists">
        <li class="tit">
            <img src="@/assets/img/baojia_icon1.png" alt="" /><span>项目信息</span>
        </li>
        <li class="clearfix list">
            <p>项目名称：</p>
            <p>{{bid_data.bid_name}}</p>
        </li>
        <li class="clearfix list">
            <p>项目编号：</p>
            <p>{{bid_data.bid_sn}}</p>
        </li>
        <li class="clearfix list">
            <p>收货地点：</p>
            <p>{{bid_data.area}}</p>
        </li>
        <li class="clearfix list">
            <p>收货时间：</p>
            <p>{{bid_data.bid_arrival_time}}</p>
        </li>
        <li class="clearfix list">
            <p>预算：</p>
            <p>{{bid_data.bid_budget}}</p>
        </li>
        </li>
        <li class="clearfix list">
            <p>最低降幅：</p>
            <p>千分之四</p>
        </li>
    </ul>
    <ul class="zb-info lists">
        <li class="tit">
            <img src="@/assets/img/baojia_icon2.png" alt="" /><span>招标信息</span>
        </li>
        <li class="clearfix list">
            <p>竞价开始时间：</p>
            <p>{{bid_data.bid_start_time}}</p>
        </li>
        <li class="clearfix list">
            <p>付款方式：</p>
            <p>{{bid_data.bid_pay_type}}</p>
        </li>
        <li class="clearfix list">
            <p>参与规则：</p>
            <p>{{guize}}</p>
        </li>
    </ul>
    <ul class="bz-info lists">
        <li class="tit">
            <img src="@/assets/img/baojia_icon3.png" alt="" /><span>备注信息</span>
        </li>
        <li class="clearfix list">
            <p>{{bid_data.bid_remark}}</p>
        </li>
    </ul>
    <div class="pro">
        <div class="tit">
            <img src="@/assets/img/baojia_icon4.png" alt="" /><span>招标产品</span>
        </div>
        <table cellspacing="0" >
            <tr>
                <th>名称</th>
                <th>数量</th>
                <th>金额</th>
                <th>详情</th>
            </tr>
            <tr v-for="(item,index) in bid_data.goods" :key="index">
                <td>{{item.goods_name}}</td>
                <td>{{item.goods_num}}</td>
                <td>{{item.goods_price}}元</td>
                <td @click="showGoods(index)" >
                  <button>产品详情</button>
                </td>            
            </tr>
           
        </table>
    </div>
    <div class="pro" >
        <div class="tit">
            <img src="@/assets/img/baojia_icon4.png" alt="" /><span>招标明细</span>
        </div>
        <table cellspacing="0" >
            <tr>
                <th>供应商</th>
                <th>金额</th>
                <th>轮次</th>
                <th>报价时间</th>
            </tr>
            <tr v-for="(item,index) in bid_data.record" :key="index">
                <td>{{item.user_company}}</td>
                <td>{{item.price}}</td>
                <td>第{{item.rotation}}轮</td>
                <td>{{item.add_time}}</td>            
            </tr>
           
        </table>
      
    </div>


</div>


</template>
<script>
    
export default {
  data(){
    return{
        headBg: false,  //左上角 “< 投标” 使用数据  当页面向下滚动  该值变为 true
        bid_data:{},
        bjVal:0.00,
        formatMoney:0.00,

        h: '00', //时
        m: '00', //分
        s: '00', //秒
        guize: '本次报价共3轮，每轮允许报价1次，每轮报价10分钟',
        goods_detail:{
          goods_name:'',
          goods_brand_model:'',//品牌型号
          goods_unit:'',
          goods_price:'',
          goods_num:'',
          goods_remark:''
        },
        downTime:'',
          
     }
  },
  async created(){
    let user_token = this.getUserToken()
    let bidid =  this.$route.query.bid_id
    let re = await this.$axios.post('bid/getBidDetail',{
        bid_id:bidid,
        user_token:user_token
    })
    if(re.code == 200){
        let toWhere = '/bid/'+re.data.toWhere;
        //如果不是当前页面跳转
        if(toWhere != this.$route.path){
            this.$router.push({path:'/'+toWhere+'?bid_id='+bidid})
            
        }else{
              let bid_data = re.data;
              this.bid_data = bid_data
              
        }    


     }

  },
  
  mounted(){
            
  },
  
  methods:{
    //显示商品
     showGoods(index){
      let goods = this.bid_data.goods[index];
      this.$createDialog({
        type:'alert',
        title:`${goods.goods_name}`,
        content: `品牌/型号: ${goods.goods_brand_model} <br/> 单位: ${goods.goods_unit} <br/> 数量: ${goods.goods_num} <br/> 单价: ${goods.goods_price} <br/> 产品说明: ${goods.goods_remark}`,
        icon: ''

      }).show()
    },
    reback(){
        if(this.$route.query.redirect){
              if(this.$route.query.bidtype){
                this.$router.replace({path:this.$route.query.redirect,query:{
                  bidtype:this.$route.query.bidtype
                }});
              }else{
                this.$router.replace({path:this.$route.query.redirect})
              }
        }else{
             this.$router.replace({path:'/'})
        }
     }

    

  },

}
</script>